All Questions
Tagged with asp.net-web-api-routingattributerouting
40 questions
0votes
1answer
470views
Route that automatically gets name from webapi action
I have ApiController that looks like [RoutePrefix("Companies")] public class CompanyController : ApiController { [HttpGet] [Route("GetCompanyProfile")] public ...
2votes
1answer
693views
Web API partially (start with) match route in Controller
How can I map multiple urls to one action method? For example http://localhost:10000/api/ABC and http://localhost:10000/api/ABCDCD will map to same action name because both starts with ABC. I can't ...
-1votes
1answer
524views
Web Api Routing: Multiple controller types were found that match the URL for parameter VS constant paths
My issue is similar to Web Api Routing : Multiple controller types were found that match the URL but I want to keep them in separate controllers. From the comments, 2 preexisting answers are good ...
0votes
1answer
2kviews
Only one GET method in controller and yet getting "Not supported by Swagger 2.0: Multiple operations with path"
I know there are many questions with the same title but this one is different. I was getting this error on my product controller, so to investigate the problem I created a demo controller in the ASP....
0votes
0answers
65views
Web Api Routing : Multiple controller types were found that match the URL
I'm getting,"Multiple controller types were found that match the URL", Error while performing postman operation for the below API Calls. Can someone help me figuring out the attribute mapping for the ...
3votes
1answer
2kviews
Attribute Routing with Parameters in Asp.Net Web API 2
In Asp.Net Web API 2 Attribute routing, If i call any attribute i need to get all list of data mapping with that attribute but I am getting the first element of a sequence that satisfies a condition. ...
1vote
1answer
2kviews
Webapi function without parameter and using HttpGet results in 404
A webapi function that uses HttpGet and does not have a parameter seems to not add the route. With this code using System.Web.Http; namespace Testing { public class FooController: ApiController { ...
2votes
1answer
2kviews
Attribute routing in different controllers results in "Multiple controller types were found that match the URL" [duplicate]
I am developing an application in .NET WebApi2 but I have a problem with the attribute routing when trying to split a controller in two. Both controllers have an action that is routed via /api/users/ ...
1vote
0answers
102views
Route attribute with wildcard on the left
I want to be able to automatically match routes that may or may not have a prefix on the left of the incoming request's route. For example, for this controller [MyRoutePrefix("api/hello-world")] ...
0votes
3answers
2kviews
ASP.NET Web API Attribute Routing To Wrong Action
I have applied attribute routing on my controller and it'srouting to wrong action. I don't know where I am getting it wrong. Here is my controller: using System.Collections.Generic; using System.Web....
2votes
1answer
497views
ASP.NET Unit testing doesn't map routes
I have a web API project that I want to test with unit tests. In the test class I create a HttpClient that is supposed to redirect the HTTP calls directly to my controllers: public static HttpClient ...
1vote
1answer
4kviews
ASP.NET Web API Route not found with Attribute Routing
I have an ASP.NET Web API project that contains multiple controllers. All controllers handle Models that exist in the database, but one. And this controller does not get his (one) Action resolved. ...
6votes
2answers
15kviews
Multiple optional parameters web api attribute routing
I am new to attribute routing, and I am not sure if this is even possible. I have an attribute route, which works fine like this: [HttpGet] [Route("GetIssuesByFlag/{flag:int=3}")] public ...
15votes
1answer
20kviews
Multiple controllers with same URL routes but different HTTP methods
I've got a following two controllers: [RoutePrefix("/some-resources") class CreationController : ApiController { [HttpPost, Route] public ... CreateResource(CreateData input) { // ...
3votes
1answer
2kviews
Attribute routing recognize optional query string parameters
I have a API action: [HttpGet, Route("{id}/overview/")] public async Task<HttpResponseMessage> Overview(string id, DateTime from, DateTime? to) { ... } As you noticed, to is optional ...